from pydantic_settings import BaseSettings, SettingsConfigDict
from app.core.constants import BASE_PATH



class Settings(BaseSettings):
    model_config = SettingsConfigDict(
        env_file=f"{BASE_PATH}/.env", env_ignore_empty=True, env_file_encoding="utf-8"
    )
    # 应用配置
    APP_TITLE: str
    APP_VERSION: str = "1.0.0"
    APP_DEBUG: bool | None = False
    APP_HOST: str
    APP_PORT: int | None = 8000
    # MySQL 配置
    MYSQL_HOST: str
    MYSQL_PORT: int | None = 3306
    MYSQL_USER: str
    MYSQL_PASSWORD: str
    MYSQL_DB: str
    # Redis 配置
    REDIS_HOST: str
    REDIS_PORT: int | None = 6379
    REDIS_PASSWORD: str | None = None
    REDIS_DB: int | None = 0


# 实例化配置对象
settings = Settings()
